package conf

import (
	"github.com/spf13/viper"
	"go.uber.org/zap"
)

// CosSection map toml [sms]
type CosSection struct {
	ScfEndPoint           string `mapstructure:"scf_end_point"`
	BucketPrefix          string `mapstructure:"bucket_prefix"`
	BucketCustomCDNDomain string `mapstructure:"bucket_custom_cdn_domain"`
}

// ReadCos get cos section from config
func ReadCos(v *viper.Viper, slog *zap.SugaredLogger) (cosConfPtr *CosSection) {
	cosConfPtr = &CosSection{}
	err := v.Unmarshal(cosConfPtr)
	if err != nil {
		slog.Panicf("unable to decode into cos section, %v", err)
	}
	return
}
